package org.balthie.cal.impl.cmd;

import java.util.Deque;

import org.balthie.cal.core.AbsCommand;
import org.balthie.cal.core.ICommand;
import org.balthie.cal.core.IControllor;

/**
 * @author：balthie@126.com
 * @createtime ： 2023年3月7日 下午1:37:55
 * @description 输出传入的文本，调试用
 * @since version 初始于版本 0.0.1-SNAPSHOT
 */
public class EchoCmd extends AbsCommand implements IControllor {

	public EchoCmd() {
		super("echo");
	}

	@Override
	public void execute(Deque<ICommand> deque, Deque<ICommand> undoArea) {
		super.println("——————————————————————————————");
		super.print("算式显示栏|  ");
		deque.stream().forEach(cmd -> super.print(cmd.getLiterally()));
		super.println();
		super.println("——————————————————————————————");
	}

	@Override
	public boolean isCompleted(Deque<ICommand> deque) {
		return Boolean.FALSE;
	}
	
	@Override
	public void isLegal(Deque<ICommand> workArea, Deque<ICommand> undoArea) {
		// echo 指令随时可以运行		
		return ;
	}

	@Override
	public String getLiterally() {
		return "显示栏 echo : ";
	}

	@Override
	public String getTips() {
		return "显示当前输入的计算式";
	}
}
